package com.ssm.annotation;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

@Service("userService")

//相当于配置文件中的:<bean id="userService" class="com.ssm.annotation.UserServiceImpl" />

public class UserServiceImpl implements UserService {
    @Resource(name = "userDao")
    //当于配置文件中的:<property name="userDao"  ref="userDao"/>


    private UserDao userDao;

    public void save() {
        //调用userDao中的save方法
        this.userDao.save();
        System.out.println("userservice....save...");
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
}
